import { defineComponent, onMounted, ref } from "vue";
import timPage from "@/assets/image/timPage.png";
import timPhone from "@/assets/image/timPhone.png";
import PageTitle from "@/components/PageTitle";
import { getParamUrl } from "@/command/util";
import { useRoute } from "vue-router";
import { phoneClick } from "@/command/apiTool";
export default defineComponent({
  setup(props, {}) {
    const route = useRoute();
    const url = ref("");
    onMounted(() => {
      let timInfo = {
        userId: route.query.userId,
        to: route.query.to,
        template: "287a53aa61aed3d900d4a9091f69dce0",
        appid: "1400804218",
        title: route.query.name,
        isShowSpeak: "0",
      };
      url.value = "https://im.ztesa.com.cn/#/?" + getParamUrl(timInfo);
      // url.value = "http://localhost:3001/#/?" + getParamUrl(timInfo);
    });
    const render1 = () => {
      // return <img class={"h-full"} src={timPage} />;
      return (
        <iframe
          style={{
            width: "100%",
            height: "100%",
          }}
          src={url.value}
        ></iframe>
      );
    };
    return () => {
      return (
        <PageTitle
          title={route.query.name ? route.query.name.toString() : ""}
          childClass="!p-[0px]"
          right={() => (
            <img
              class={"w-[22px] h-[22px]"}
              src={timPhone}
              onClick={() => phoneClick(route.query.to)}
            />
          )}
        >
          {render1()}
        </PageTitle>
      );
    };
  },
});
